package com.baoleme.service;


import com.baoleme.dto.LoginDTO;
import com.baoleme.entity.Member;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@Slf4j
@SpringBootTest
public class usertest {

    @Resource
    MemberService service;

    @Test
    public void login(){
        LoginDTO loginDTO=new LoginDTO();
        loginDTO.setName("zhangsan");
        loginDTO.setPassword("123456");
//        BusinessException b = Assertions.assertThrows(BusinessException.class, () -> {
//            String token = service.login(loginDTO);
//            log.info(token);
//     });
        String login = service.login(loginDTO);
        log.info(login);

    }


    @Test
    public void rigester(){
        Member member=new Member();
        member.setName("lisi");
        member.setPassword("123456");
        member.setPhone("12345678901");
        member.setIdCard("350628200002022015");
        //        BusinessException b = Assertions.assertThrows(BusinessException.class, () -> {
//          boolean saveUser = service.saveUser(member);
//     });

        boolean saveuser = service.saveUser(member);

    }

    @Test
    public void logout(){

        //        BusinessException b = Assertions.assertThrows(BusinessException.class, () -> {
//            service.logout("wangwu");
//     });
        service.logout("zhangsan");
    }
}
